home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11339 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: solon.com!not-for-mail
  2. From: garyq@hpfcla.fc.hp.com (Gary Quakenbush)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
  4. Subject: Re: C coding problem
  5. Followup-To: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
  6. Date: 23 Mar 1996 00:46:02 -0600
  7. Organization: Hewlett-Packard Fort Collins Site
  8. Sender: clc@solutions.solon.com
  9. Approved: clc@solutions.solon.com
  10. Message-ID: <4j06na$808@solutions.solon.com>
  11. References: <4ianbf$h86@solutions.solon.com> <4iemcl$a05@solutions.solon.com> <4io1io$no4@solutions.solon.com>
  12. NNTP-Posting-Host: solutions.solon.com
  13. X-Newsreader: TIN [version 1.2 PL1.4]
  14.  
  15. Konrad Schwarz (schwarz@mips.complang.tuwien.ac.at) wrote:
  16. : One of C's most defining attributes is the pointer concept
  17. : which includes the mapping of arrays to pointer arithmetic.  If you're
  18. : going to fight it, it might be better to switch to some other programming
  19. : language.
  20.  
  21. : I recently wrote a loop that went like this:
  22.  
  23. : while (p < end_p)
  24. :     ++*p++;
  25.  
  26. : Maybe some will find it a counter-example; I think it's good
  27. : code that embodies the way C is designed to work.  Arrays are
  28. : second rate objects in C.  Use pointers.
  29.  
  30. Ok, I'll bite.
  31.  
  32. This could be useful as an interview question.
  33.  
  34. Interviewee gets points for quickly locating in C reference the info
  35. needed to understand this.
  36.  
  37. Interviewee gets extra points for mentioning maintainability tradeoffs.
  38.  
  39. Interviewee gets hired if she rewrites to be trivial for "contractor of
  40. the month" to understand and maintain.
  41.